﻿// -----------------------------------------------------------------------
// <copyright file="CustomSPGridViewTemplate.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

namespace Metro.GridView
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class CustomSPGridViewTemplate : ITemplate
    {
        private ListItemType _itemType;

        private string _columnName;

        public CustomSPGridViewTemplate(ListItemType itemType, string columnName)
        {

            _itemType = itemType;

            _columnName = columnName;

        }

        public void InstantiateIn(Control container)
        {

            switch (_itemType)
            {

                case ListItemType.Header:

                    LiteralControl header = new LiteralControl();

                    header.Text = string.Format("<b>{0}</b>", _columnName);

                    container.Controls.Add(header);

                    break;

                case ListItemType.Item:

                    CheckBox checkboxitem = new CheckBox();

                    checkboxitem.ID = "selectedTask";

                    checkboxitem.Visible = true;

                    container.Controls.Add(checkboxitem);

                    HtmlInputHidden taskIdItem = new HtmlInputHidden();

                    taskIdItem.ID = "taskIdItem";

                    container.Controls.Add(taskIdItem);

                    break;

                default:

                    break;

            }

        }

    }
}
